Place Search Plugin for Mappls Web Maps¶
Easy To Integrate Maps & Location APIs & SDKs For Web & Mobile Applications
Powered with India's most comprehensive and robust mapping functionalities. Now Available for 200+ nations and territories accross the world.
Getting Access¶
Before using the API in the your solution, please ensure that the related access is enabled in the Mappls Console, within your app - be it for Mobile OR Web or Cloud integration.
- Copy and paste the key from your
credentials
section from your API keys into theaccess_token
query parameter.- Your static key can be secured by whitelisting its usage for particular IPs (in case of cloud app usage) OR a set of domains (in case of a web app)
- Your static key obtained from your Console is to be passed as a query parameter:
access_token
.
- The sample codes are provided on our domain to help you understand the very basic functionality of Mappls Place Search Plugin. See Sample Codes here
Authentication Object - access_token
mandatory query parameter.¶
access_token
: "hklmgbwzrxncdyavtsuojqpiefrbhqplnm".
Document Version History¶
Version | Last Updated | Team | Author | Remarks |
---|---|---|---|---|
1.0 | 07 Aug 2025 | SDK Product Team | Prabhjot Kaur (PK) | OAuth 2 |
Introduction¶
A simple plugin / widget to search for places powered by the best online maps from Mappls. The Place Search plugin for Mappls Web Map JS library is provided as a means to enable searching of Places on Mappls Maps.
The plugin can be used in combination with our Interactive Map JS library but it also possesses the adaptability to be used as an independent plugin within any web app implementation. Thus it enables developers to include Mappls Places JS in their own customized solutions easily.
The SDK offers the following basic functionalities: 1. Ability to search for places directly with or without Mappls Maps visual interface. 2. A mappls.search() method to initiate search across all types places available on Mappls. 3. Ability to get information from Mappls Place Search plugin through a callback 4. Include the Place Search Plugin with or without an interactive Map component.
Sample Implementation¶
Visit the samples for assistance to create a sample implementation with your own keys.
For detailed understanding of the plugin, Let’s get started!
Plugin's Configurations¶
Adding the Nearby Search plugin in the script
<script src="https://sdk.mappls.com/map/sdk/plugins?access_token=<Static Key>&v=3.0&libraries=search"></script>
1. Initializing the Place Search plugin¶
Method¶
mappls.search()
/*Search plugin initialization*/
var placeOptions=
{
location:[28.61, 77.23]/*,
geolocation:true,
pod:'City',
bridge:true,
tokenizeAddress:true,*
filter:'cop:9QGXAM',
hyperLocal:true, Default is false. Location parameter is mandatory to use this parameter.
distance:true,
width:300,
height:300,
clearButton:false, //to hide cross button, which is right side of search input
blank_callback:function(){console.log("called when click on cross button or input value become blank");}
*/
};
new mappls.search(document.getElementById("auto"),placeOptions,callback);
Mandatory Parameters¶
inputQuery
: The string which will be passed as input query to the search engine.
Optional Parameters¶
Place Options
: Optional configurations for modifying the search request.location
: location coordinates which will be used as radial bias (not restriction; only BIAS). e.g.location:[28.61, 77.23]
pod
: Place type which you want to restrict the results by. e.g.pod:'city'
. Valid values are:- SLC (sub locality)
- LC (locality)
- CITY
- VLG (village)
- SDIST (sub district)
- DIST (district)
- STATE
- SSLC (sub sub locality)
filter
: a parameter to restrict results by. e.g.filter:'cop:9qgxam'
- Can be used to filter results by PIN code. e.g.
pin:110055
- Can be used to filter results by eLoc. e.g.
cop:9qgxam
- Can be used to filter results by view bound. e.g.
filter=bounds:28.598882,77.212407;28.467375,77.353513
- Can be used to filter results by PIN code. e.g.
bridge
: initiates a bridge to be created to provide applicable nearby API searches. Involves using Nearby Search Plugin in conjunction with Place Search Plugin.hyperLocal
:This parameter lets the search give results that are hyper-localized to the reference location passed in the location parameter. This means that nearby results are given higher ranking than results far from the reference location. Highly prominent results will still appear in the search results, however theu will be lower in the list of results. This parameter will work ONLY in conjunction with the location parameter.tokenizeAddress
: boolean value used to return address tokens from the searched places from Mappls Search APIs. e.g.tokenizeAddress:true
distance
: boolean value used to show aerial distance from location passed inlocation
. of the searched place in results listing e.g.distance:true
geolocation
: boolean value used to enable or disable current location selection . Default is true.width
: width of the suggested div. e.g.width:300
height
: height of the suggested div. e.gheight:300
clearButton
: clear the value of input box. Default is true.
callback
: callback to get results/error after call or selection.blank_callback
: callback when user clicks the cross button or erase the value of input box.searchChars
: number of characters required to start search. e.gsearchChars
:2region
: To specify the region for various api response.e.gregion
: "USA"
2. Calling Mappls Place Search for programmatically fixed text¶
Following is an example of calling Mappls.search() method programmatically for a fixed text rather than depending on a UI driven approach:
/*CALL for fix text - LIKE THIS*/
new mappls.search("agra",placeOptions,callback);
Other Useful Methods¶
setToken("token")
- This method is used when you receive a callback of token error. To set new token following method should be refered.
For Eg: if the users receives an error in callback like {error: "error-Passport invalid-Passport seems to be invalid or not active anymore-responsecode:401"}, use
mappls.setToken();
If this returns true, then the token is placed successfuly, otherwise token is not valid.
That's All !
Visit the samples for assistance to create a sample implementation with your own keys.
For any queries and support, please contact:
Email us at apisupport@mappls.com
Support
Need support? contact us!